# @Author：silence
# @Email：792245022@qq.com
# @Date：2025/3/2 19:06

import urllib.request

url = "https://www.baidu.com"

# url 的组成
# 1、协议
#   - http
#   - https
# 2、域名
# 3、端口
# 4、路径
# 5、参数
# 6、锚点

# UA：用户代理
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
}

# 请求对象的定制
request = urllib.request.Request(url=url, headers=headers)

response = urllib.request.urlopen(request)

content = response.read().decode("utf-8")

print(content)